package com.dqyt.khjc.utils;

import com.dqyt.common.constant.Constant;

public class NumberUtil {
    /**
     * 生成表示编号
     * @param num
     * @param length
     * @param type
     * @return
     */
    public static String calculationBsbh(int num,int length,int type){
        String bsbhStr ="";

        String nianStr  =TimeUtil.formatTime_Year(TimeUtil.getCurrentTimeMillis());

        if(type ==1){ //面罩
            switch (length){
                case 0:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ + String.valueOf(num);
                    break;
                case 1:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"0"+String.valueOf(num);
                    break;
                case 2:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"00"+String.valueOf(num);
                    break;
                case 3:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"000"+String.valueOf(num);
                    break;
                case 4:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"0000"+String.valueOf(num);
                    break;
                case 5:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"00000"+String.valueOf(num);
                    break;
                case 6:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"000000"+String.valueOf(num);
                    break;
                case 7:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"0000000"+String.valueOf(num);
                    break;
                case 8:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"00000000"+String.valueOf(num);
                    break;
                case 9:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"000000000"+String.valueOf(num);
                    break;
                case 10:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"0000000000"+String.valueOf(num);
                    break;
            }


        }else{  //气瓶
            switch (length){
                case 0:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP + String.valueOf(num);
                    break;
                case 1:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"0"+String.valueOf(num);
                    break;
                case 2:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"00"+String.valueOf(num);
                    break;
                case 3:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"000"+String.valueOf(num);
                    break;
                case 4:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"0000"+String.valueOf(num);
                    break;
                case 5:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"00000"+String.valueOf(num);
                    break;
                case 6:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"000000"+String.valueOf(num);
                    break;
                case 7:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"0000000"+String.valueOf(num);
                    break;
                case 8:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"00000000"+String.valueOf(num);
                    break;
                case 9:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"000000000"+String.valueOf(num);
                    break;
                case 10:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"0000000000"+String.valueOf(num);
                    break;
            }
        }
        return bsbhStr;

    }
    /**
     * 生成表示编号
     * @param num
     * @param length
     * @param type
     * @return
     */
    public static String calculationBsbh2(int num,int length,int type,String rwdbh){
        String bsbhStr ="";

        String nianStr  = rwdbh.substring(0,4);

        if(type ==1){ //面罩
            switch (length){
                case 0:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ + String.valueOf(num);
                    break;
                case 1:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"0"+String.valueOf(num);
                    break;
                case 2:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"00"+String.valueOf(num);
                    break;
                case 3:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"000"+String.valueOf(num);
                    break;
                case 4:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"0000"+String.valueOf(num);
                    break;
                case 5:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"00000"+String.valueOf(num);
                    break;
                case 6:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"000000"+String.valueOf(num);
                    break;
                case 7:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"0000000"+String.valueOf(num);
                    break;
                case 8:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"00000000"+String.valueOf(num);
                    break;
                case 9:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"000000000"+String.valueOf(num);
                    break;
                case 10:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_HXQ +"0000000000"+String.valueOf(num);
                    break;
            }


        }else{  //气瓶
            switch (length){
                case 0:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP + String.valueOf(num);
                    break;
                case 1:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"0"+String.valueOf(num);
                    break;
                case 2:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"00"+String.valueOf(num);
                    break;
                case 3:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"000"+String.valueOf(num);
                    break;
                case 4:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"0000"+String.valueOf(num);
                    break;
                case 5:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"00000"+String.valueOf(num);
                    break;
                case 6:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"000000"+String.valueOf(num);
                    break;
                case 7:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"0000000"+String.valueOf(num);
                    break;
                case 8:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"00000000"+String.valueOf(num);
                    break;
                case 9:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"000000000"+String.valueOf(num);
                    break;
                case 10:
                    bsbhStr = nianStr+ Constant.QRQODE_HEAD_QP +"0000000000"+String.valueOf(num);
                    break;
            }
        }
        return bsbhStr;

    }
}
